package cn.ipenta.config;

import java.util.HashMap;
import java.util.Map;

/**
 * @author ipenta
 * @ClassName: ss
 * @Description: TODO
 * @date 2017-09-27 下午1:19
 */
public class ResultMapper {

	public final static String STATUS = "status";
	public final static String MESSAGE ="message";
	public final static String DATA ="data";

	public final static String STATUS_SUCCESS = "success";
	public final static String STATUS_FAIL = "fail";

	public static <T> Map<String, Object> success(T t){

		Map<String, Object> map = new HashMap<>();
		map.put(STATUS, STATUS_SUCCESS);
		map.put(MESSAGE, "");
		map.put(DATA, t);
		return map;
	}

	public static <T> Map<String, Object> fail(T message){

		Map<String, Object> map = new HashMap<>();
		map.put(STATUS, STATUS_FAIL);
		map.put(MESSAGE, message);
		return map;
	}

}

